function saveData() {
	var form = baseJs.getForm("addForm");
	if (!form.isVal()) {
		alert("请按要求填写数据！");
		return;
	}
	var load = baseJs.loadding();
	$.post(host + "tableAction/saveTable.html", form.getItems(), function(data) {
		load.close();
		if (data.result) {
			try {
				baseJs.getOpenWindow().alert(data.msg);
				baseJs.getOpenWindow().initTree();
			} catch (e) {
				alertObject(e);
			}
			baseJs.closeWindow();
		} else {
			alert("error: " + data.msg);
		}
	}, "json");
}

$(function() {
	var id = baseJs.request("id");
	//初始化客户类型下拉菜单
	$.post(host + "tableAction/getTableType.html", {}, function(data) {
		$("#parentId").append("<option value=''>--根目录--</option>");
		data = data.data;
		for (var i = 0;i < data.length;i ++) {
			$("#parentId").append("<option value='" + data[i].id + "'>" + data[i].text + "</option>");
		}
		if (id) {
			$("#id").val(id);
			baseJs.initPageEditData(host + "tableAction/getTableInfoById.html", {id: id});
		}
	}, "json");
});
function closeWin() {
	baseJs.closeWindow();
}